
#ifndef __HUAYI_ALG_H__
#define __HUAYI_ALG_H__

#include <stdio.h>

#include <QString>

#ifdef __cplusplus
extern "C"
{
#endif

    enum enumHYAlgType
    {
        HYALG_DES = 0,
        HYALG_3DES,
        HYALG_SM4,
    };

    enum enumAlgMode
    {
        ALG_MODE_ECB = 0,
        ALG_MODE_CBC,
        ALG_MODE_MAC
    };
    enum enumAlgEncOrDec
    {
        ALG_ENC = 0,
        ALG_DEC,
    };

    enum enumHYAlgType1
    {
        ALG_SM4 = (0x00000400),
        ALG_SM4_ECB = (0x00000401),
        ALG_SM4_CBC = (0x00000402),
        ALG_SM4_CFB = (0x00000404),
        ALG_SM4_OFB = (0x00000408),
        ALG_SM4_MAC = (0x00000410),
        ALG_SM4_CTR = (0x00000420),
        ALG_SM4_XTS = (0x00000440),

        ALG_DES = (0x00001000),
        ALG_DES_ECB = (0x00001001),
        ALG_DES_CBC = (0x00001002),
        ALG_DES_CFB = (0x00001004),
        ALG_DES_OFB = (0x00001008),
        ALG_DES_MAC = (0x00001010),
        ALG_DES_CTR = (0x00001020),

        ALG_3DES = (0x00002000),
        ALG_3DES_ECB = (0x00002001),
        ALG_3DES_CBC = (0x00002002),
        ALG_3DES_CFB = (0x00002004),
        ALG_3DES_OFB = (0x00002008),
        ALG_3DES_MAC = (0x00002010),
        ALG_3DES_CTR = (0x00002020),
    };

    extern QString HYALG_SM3Hash(QString indata);
    extern QString HYALG_SM4Crypt(enumAlgMode mode, enumAlgEncOrDec type, QString key, QString iv, QString indata);
    extern QString HYALG_DESCrypt(enumAlgMode mode, enumAlgEncOrDec type, QString key, QString iv, QString indata);

#ifdef __cplusplus
}
#endif

#endif // __HUAYI_ALG_H__
